VMWare虚拟机扩展磁盘空间(扩充root根目录空间) 您所在的位置:网站首页 linux root 扩容 VMWare虚拟机扩展磁盘空间(扩充root根目录空间)

VMWare虚拟机扩展磁盘空间(扩充root根目录空间)

2024-07-15 16:48| 来源: 网络整理| 查看: 265

1. 扩展虚拟机磁盘空间

Vm虚拟机下Linux扩展原有磁盘空间,10G 在这里插入图片描述 10G的基础上不能满足需求,只好进行磁盘扩展。 在这里插入图片描述 调整到合适的磁盘空间 在这里插入图片描述 在这里插入图片描述 需注意以下几点: linux只能扩展磁盘容量而不能减小, 所填写的容量为总容量,即包含已分区的磁盘。

2.查看、创建系统分区 启动虚假机,查看磁盘分区 [root@node1 ~]# fdisk -l

在这里插入图片描述 总磁盘大小32.2GB,其中磁盘分了sda1,sda2两个分区。Linux LVM为虚拟机分区约有9GB磁盘空间。

创建新分区 [root@node1 ~]# fdisk /dev/sda #输入m查看帮助文档 Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition #创建新分区 o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only)

3.执行分区创建

Command (m for help): n Partition type: p primary (2 primary, 0 extended, 2 free) #创建主分区 e extended #创建扩展分区 Select (default p): p Partition number (3,4, default 3): #由前面已有2个分区,所有从3开始 First sector (20971520-62914559, default 20971520): #一路回车即可 Using default value 20971520 Last sector, +sectors or +size{K,M,G} (20971520-62914559, default 62914559): Using default value 62914559 Partition 3 of type Linux and of size 20 GiB is set Command (m for help): w #保存退出 The partition table has been altered!

4.重新查看分区

我们的新建分区/dev/sda3

[root@node1 ~]# fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00009cb6 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 20971519 9436160 8e Linux LVM #sda3为新创建的分区 /dev/sda3 20971520 62914559 20971520 83 Linux Disk /dev/mapper/centos-root: 8585 MB, 8585740288 bytes, 16769024 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-swap: 1073 MB, 1073741824 bytes, 2097152 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

4.查看文件系统格式、分区格式化

#查看文件系统格式 df -T -h #分区格式化 mkfs.xfs /dev/sda3 #格式化为xfs格式 #进入lvm管理 lvm lvm> pvcreate /dev/sda3 #这是初始化刚才的分区3 WARNING: ext4 signature detected on /dev/sda3 at offset 1080. Wipe it? [y/n]: y Wiping ext4 signature on /dev/sda3. Physical volume "/dev/sda3" successfully created. lvm> vgdisplay -v #卷和卷组的命令可以通过 vgdisplay查看 --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有